package com.erp.erp_servers.warehouse.imp;

import com.erp.erp_dao.warehouse.ITransferDao;
import com.erp.erp_entitys.warehouse.entity.TransferEntity;
import com.erp.erp_entitys.warehouse.req.QueryTransferReq;
import com.erp.erp_entitys.warehouse.req.StatisticsTransferAndContractInfoReq;
import com.erp.erp_entitys.warehouse.req.StatisticsTransferInStockInfoReq;
import com.erp.erp_entitys.warehouse.rsp.StatisticsTransferAndContractInfoRsp;
import com.erp.erp_entitys.warehouse.rsp.StatisticsTransferInStockInfoRsp;
import com.erp.erp_servers.warehouse.ITransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : TransferServiceImp
 * @Description : 调拨实现类
 * @Author : lst
 * @Date: 2020-07-31 13:48
 */
@Service
public class TransferServiceImp implements ITransferService {

    /**
     * 调拨接口
     */
    private final ITransferDao transferDao;

    @Autowired
    public TransferServiceImp(ITransferDao transferDao) {
        this.transferDao = transferDao;
    }

    /**
     * 通过实体作为筛选条件查询
     *
     * @param transfer 实例对象
     * @return 对象列表
     */
    @Override
    public List<TransferEntity> queryAll(TransferEntity transfer) {
        return transferDao.queryAll(transfer);
    }

    /**
     * 通过条件查询调拨对象
     * @param req 查询条件实体对象
     * @return 调拨集合
     */
    @Override
    public List<TransferEntity> queryTransferList(QueryTransferReq req) {
        return transferDao.queryTransferList(req);
    }

    /**
     * 新增数据
     *
     * @param transfer 实例对象
     * @return 影响行数
     */
    @Override
    public int insert(TransferEntity transfer) {
        return transferDao.insert(transfer);
    }


    /**
     * 通过id获取调拨对象
     * @param id 调拨id
     * @return 调拨对象
     */
    @Override
    public TransferEntity getTransferById(Integer id) {
        return transferDao.getTransferById(id);
    }

    /**
     * 修改数据
     *
     * @param transfer 实例对象
     * @return 影响行数
     */
    @Override
    public int update(TransferEntity transfer) {
        return transferDao.update(transfer);
    }

    /**
     * 外销调拨明细统计
     * @param req 实例对象
     * @return 外销调拨明细统计
     */
    @Override
    public List<StatisticsTransferAndContractInfoRsp> statisticsTransferAndContractInfo(StatisticsTransferAndContractInfoReq req) {
        return transferDao.statisticsTransferAndContractInfo(req);
    }


    /**
     * 调拨仓库入库详情统计
     * @param req 实例对象
     * @return 调拨仓库入库详情统计
     */
    @Override
    public List<StatisticsTransferInStockInfoRsp> getStatisticsTransferInStockInfo(StatisticsTransferInStockInfoReq req) {
        return transferDao.getStatisticsTransferInStockInfo(req);
    }
}
